<?php
/**
 * Created by PhpStorm.
 * User: zd
 * Date: 2018/10/6
 * Time: 15:29
 */

namespace app\api\behavior;


class CORS
{
    public function appInit(){
        header("Access-Control-Allow-Origin:*");
        header("Access-Control-Allow-Credentials:true");
        header("Access-Control-Allow-Headers:token,Origin,X-Requested-With,Content-Type,Accept");
        header("Access-Control-Allow-Methods:POST,GET,PUT,DELETE");
        if (request()->isOptions()){
            exit();
        }
    }
}